From: Stefan Monnier Date: Tue, 14 May 2024 21:09:39 +0000 (+0300) Subject: (xref--collect-matches): Move inhibit-modification-hooks binding down X-Git-Tag: archive/raspbian/1%30.1+1-3+rpi1^2~14^2~18^2~1492 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=85043246f14933eedf3d2c7c6f5ab603ec3f6a21;p=emacs.git (xref--collect-matches): Move inhibit-modification-hooks binding down * lisp/progmodes/xref.el (xref--collect-matches): Move the inhibit-modification-hooks binding a little down (bug#53749). (xref--show-common-initialize): Add sharp-quoting. --- diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index f9faec1b474..9013729c505 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1282,7 +1282,7 @@ Return an alist of the form ((GROUP . (XREF ...)) ...)." (erase-buffer) (setq overlay-arrow-position nil) (xref--insert-xrefs xref-alist) - (add-hook 'post-command-hook 'xref--apply-truncation nil t) + (add-hook 'post-command-hook #'xref--apply-truncation nil t) (goto-char (point-min)) (setq xref--original-window (assoc-default 'window alist) xref--original-window-intent (assoc-default 'display-action alist)) @@ -2112,10 +2112,7 @@ Such as the current syntax table and the applied syntax properties." (defun xref--collect-matches (hit regexp tmp-buffer syntax-needed) (pcase-let* ((`(,line ,file ,text) hit) (file (and file (concat xref--hits-remote-id file))) - (buf (xref--find-file-buffer file)) - ;; This is fairly dangerouns, but improves performance - ;; for large lists, see https://debbugs.gnu.org/53749#227 - (inhibit-modification-hooks t)) + (buf (xref--find-file-buffer file))) (if buf (with-current-buffer buf (save-excursion @@ -2130,6 +2127,9 @@ Such as the current syntax table and the applied syntax properties." ;; Using the temporary buffer is both a performance and a buffer ;; management optimization. (with-current-buffer tmp-buffer + ;; This let is fairly dangerouns, but improves performance + ;; for large lists, see https://debbugs.gnu.org/53749#227 + (let ((inhibit-modification-hooks t)) (erase-buffer) (when (and syntax-needed (not (equal file xref--temp-buffer-file-name))) @@ -2144,7 +2144,7 @@ Such as the current syntax table and the applied syntax properties." (setq-local xref--temp-buffer-file-name file) (setq-local inhibit-read-only t) (erase-buffer)) - (insert text) + (insert text)) (goto-char (point-min)) (when syntax-needed (syntax-ppss-flush-cache (point)))